package com.xinyue.design.staticProxy;

/**
 * 安全代理类
 * 持有被代理类的引用
 */
public class SecurityProxy implements Proxy{
	private Proxy proxy;
	
	public String info = "";
	
	/**
	 * 构造器
	 * 传入该代理类所要代理的对象
	 * @param proxy
	 */
	public SecurityProxy(Proxy proxy) {
		this.proxy = proxy;
	}

	public void work() {
		System.out.println("SecurityProxy begin!");
		if("agree".equals(info)) {
			proxy.work();
		}
		System.out.println("SecurityProxy end!");
	}
}
